import axios from 'axios'
import { actionTypes } from './index'

const changeDetailData = (data) => ({
    type: actionTypes.CHANGE_DETAIL_DATA,
    title : data.title,
    content: data.content
})

export const getDetail = (id)=>{
    return (dispatch) => {
        axios.get('/api/detail.json?id='+id).then((res)=>{
            const data = res.data
            if(data.success){
                dispatch(changeDetailData(data.data))
            }else{

            }
        }).catch((error) => {

        })
    }
}